Skip to main content

Product Search

GET /api/v1/Products/search

Description

This endpoint allows searching for products based on the provided search text.

Headers:

  • No specific headers are required.

Query Parameters:

  • searchText: The text to search for in product names and descriptions.

  • pageNumber: The page number to retrieve, defaults to 1 if not provided.

  • pageSize: The number of products to retrieve per page, defaults to 10 if not provided.

  • version: The version of the API.

URL:

  • GET: /api/v1/Products/search?searchText={searchText}&pageNumber={pageNumber}&pageSize={pageSize}

Response:

  • 200: Success, returns a paged list of product responses matching the search criteria.

Error Codes:

  • 400: Bad request, the request is not valid.

  • 404: Not found, no products matching the search criteria were found.

  • 500: Internal server error, something went wrong while processing the request.

Example Response:

HTTP/1.1 200 OK
{
"pageNumber": 1,
"pageSize": 10,
"totalItems": 5,
"products": [
{
"id": "123",
"name": "Product1",
"description": "Description of Product1",
"price": 100.00,
"categoryId": "abc123",
"imageUrl": "https://example.com/product1.jpg",
"availability": true,
"createdAt": "2024-02-16T12:00:00Z",
"updatedAt": "2024-02-17T12:00:00Z"
},
{
"id": "456",
"name": "Product2",
"description": "Description of Product2",
"price": 200.00,
"categoryId": "def456",
"imageUrl": "https://example.com/product2.jpg",
"availability": false,
"createdAt": "2024-02-16T12:00:00Z",
"updatedAt": "2024-02-17T12:00:00Z"
},
...
]
}

Notes:

  • This endpoint is useful for searching for products by their names or descriptions.

  • The response includes a paged list of products along with their details including ID, name, description, price, category ID, image URL, availability, and creation/update timestamps.

  • If no products matching the search criteria are found, a 404 Not Found response will be returned.

Method: GET

/api/v1/Products/search?searchText=<string>&pageNumber=1&pageSize=10

Headers

Content-TypeValue
Accepttext/plain

Query Params

Paramvalue
searchText<string>
pageNumber1
pageSize10

Response: 200

{
"pageNumber": "<integer>",
"pageSize": "<integer>",
"total": "<integer>",
"succeeded": "<boolean>",
"message": "<string>",
"errors": [
"<string>",
"<string>"
],
"data": [
{
"id": "<uuid>",
"merchantId": "<uuid>",
"name": "<string>",
"number": "<string>",
"description": "<string>",
"salesPrice": "<double>",
"documents": [
{
"id": "<uuid>",
"externalId": "<uuid>",
"url": "<string>",
"name": "<string>"
},
{
"id": "<uuid>",
"externalId": "<uuid>",
"url": "<string>",
"name": "<string>"
}
]
},
{
"id": "<uuid>",
"merchantId": "<uuid>",
"name": "<string>",
"number": "<string>",
"description": "<string>",
"salesPrice": "<double>",
"documents": [
{
"id": "<uuid>",
"externalId": "<uuid>",
"url": "<string>",
"name": "<string>"
},
{
"id": "<uuid>",
"externalId": "<uuid>",
"url": "<string>",
"name": "<string>"
}
]
}
]
}

LANGUAGE

AUTHORIZATION

Bearer

CURL REQUEST


curl --request GET \ 
--url /api/v1/Products/search \
--header 'accept: application/json' \
--header 'content-type: application/json'

RESPONSE


Click Try It! to start a request and see the response here!